<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="osgi,karaf,bndtools," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="BndtoolsBndtools是Neil Bartlett基于OSGi推动者Peter Kriens开发的Bnd工具创建的图形化开发工具。Bnd已成为OSGi开发工具中的底层基础构件，Maven Bundle Plugin插件的实现也是基于Bnd。目前，通过Bnd/Bndtools已经可以为OSGi开发提供完整的生态支持。
Bndtools的特性
导入分析不同于使用依赖描述文件，Bndtools">
<meta property="og:type" content="article">
<meta property="og:title" content="Apache Karaf构建动态模块化应用(2)--使用Bndtools开发Bundle">
<meta property="og:url" content="http://chrisrc.me/2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/index.html">
<meta property="og:site_name" content="山中，山外与俯瞰">
<meta property="og:description" content="BndtoolsBndtools是Neil Bartlett基于OSGi推动者Peter Kriens开发的Bnd工具创建的图形化开发工具。Bnd已成为OSGi开发工具中的底层基础构件，Maven Bundle Plugin插件的实现也是基于Bnd。目前，通过Bnd/Bndtools已经可以为OSGi开发提供完整的生态支持。
Bndtools的特性
导入分析不同于使用依赖描述文件，Bndtools">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_install.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_example.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj1.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj2.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj3.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj4.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj5.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj6.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_repo.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_proj7.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_run.png">
<meta property="og:image" content="http://chrisrc.me/images/java_osgi_bndtools_run_result.png">
<meta property="og:updated_time" content="2016-12-17T04:03:28.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Apache Karaf构建动态模块化应用(2)--使用Bndtools开发Bundle">
<meta name="twitter:description" content="BndtoolsBndtools是Neil Bartlett基于OSGi推动者Peter Kriens开发的Bnd工具创建的图形化开发工具。Bnd已成为OSGi开发工具中的底层基础构件，Maven Bundle Plugin插件的实现也是基于Bnd。目前，通过Bnd/Bndtools已经可以为OSGi开发提供完整的生态支持。
Bndtools的特性
导入分析不同于使用依赖描述文件，Bndtools">
<meta name="twitter:image" content="http://chrisrc.me/images/java_osgi_bndtools_install.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://chrisrc.me/2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/"/>





  <title> Apache Karaf构建动态模块化应用(2)--使用Bndtools开发Bundle | 山中，山外与俯瞰 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">山中，山外与俯瞰</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">一次永不停止的探索之旅</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-dcos">
          <a href="/dcos" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-book"></i> <br />
            
            DC/OS
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="st-search-show-outputs">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <form class="site-search-form">
  <input type="text" id="st-search-input" class="st-search-input st-default-search-input" />
</form>

<script type="text/javascript">
  (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
    (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
    e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
  })(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');

  _st('install', 'R9GcmhBwxpsAGLNCsquZ','2.0.0');
</script>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Apache Karaf构建动态模块化应用(2)--使用Bndtools开发Bundle
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2015-07-29T20:38:35+08:00">
                2015-07-29
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/OSGi/" itemprop="url" rel="index">
                    <span itemprop="name">OSGi</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="Bndtools"><a href="#Bndtools" class="headerlink" title="Bndtools"></a>Bndtools</h2><p><a href="http://bndtools.org/" target="_blank" rel="external">Bndtools</a>是Neil Bartlett基于OSGi推动者Peter Kriens开发的<a href="http://www.aqute.biz/Bnd/Bnd" target="_blank" rel="external">Bnd工具</a>创建的图形化开发工具。Bnd已成为OSGi开发<br>工具中的底层基础构件，Maven Bundle Plugin插件的实现也是基于Bnd。目前，通过Bnd/Bndtools已经可以为OSGi开发提供完整的生态支持。</p>
<h2 id="Bndtools的特性"><a href="#Bndtools的特性" class="headerlink" title="Bndtools的特性"></a>Bndtools的特性</h2><ul>
<li>导入分析<br>不同于使用依赖描述文件，Bndtools通过字节码分析精确计算OSGi Bundle的依赖。</li>
<li>Bundle仓库<br>Bndtools提供了一个可插件式的Bundle仓库，这个仓库既可用于开发过程也可以在运行时使用，并且可以和OBR及Maven/Nexus对接。</li>
<li>依赖解析<br>Bndtools使用OSGi Resolver规范解析运行时依赖，开发人员仅关注直接bundle依赖即可。</li>
<li>自动版本控制<br>Bndtools的 <strong>Release</strong> 功能可以将bundle发布到仓库，在发布时可以自动与之前的版本基线进行比较，确定bundle和package的版本。</li>
<li>即时编译<br>借助于Eclipse自动编译保存的代码的功能，Bndtools在此基础上自动打包bundle，因此，开发调试时，bundle始终包含了最新代码。</li>
<li>集成测试<br>Bndtools包含了一个OSGi运行时用于集成测试，可以为选定的一组bundle启动OSGi框架，并在测试结束时停止框架，测试结果集成显示在Eclipse JUnit视图上。</li>
</ul>
<h2 id="Bndtools的安装"><a href="#Bndtools的安装" class="headerlink" title="Bndtools的安装"></a>Bndtools的安装</h2><p>通过Eclipse: <strong>Help -&gt; Eclipse MarketPlace…</strong> 下载安装Bndtools插件：<br><img src="/images/java_osgi_bndtools_install.png" alt="Bndtools Install"></p>
<h2 id="Bndtools开发示例"><a href="#Bndtools开发示例" class="headerlink" title="Bndtools开发示例"></a>Bndtools开发示例</h2><p>下面的示例已经成为OSGi开发的经典示例，这里仍借用此例，重点在于验证Bndtools的易用性和OSGi开发中的一些重要概念。</p>
<p><img src="/images/java_osgi_bndtools_example.png" alt="Bndtools Demo"></p>
<p>此示例包括四个部分，既演示了Java中最重要的 <strong>接口分离开发策略</strong>，也演示了OSGi <strong>Bundle粒度控制</strong>，OSGi <strong>服务的发布与使用</strong>。</p>
<ul>
<li>API Bundle包含服务接口</li>
<li>Provider Bundle提供了服务接口的一个实现</li>
<li>Command Bundle使用接口服务，并注册为felix shell command服务实现</li>
<li>通过Felix Shell控制台调用命令服务</li>
</ul>
<h3 id="创建API-接口Bundle工程"><a href="#创建API-接口Bundle工程" class="headerlink" title="创建API 接口Bundle工程"></a>创建API 接口Bundle工程</h3><p>在前述Bndtools插件成功安装之后，进入Eclipse：<strong>File&gt; New&gt; Project</strong> 向导，选择 <strong>Bndtools OSGi Project</strong> :<br><img src="/images/java_osgi_bndtools_proj1.png" alt="Bnd API Bundle"></p>
<p>在“New Bndtools OSGi Project”界面，设定工程命名为“greeter-api”:<br><img src="/images/java_osgi_bndtools_proj2.png" alt="Bnd API Bundle"></p>
<p>在下一步的Project Template中，为API Bundle选择 <strong>Empty Project</strong> 模板:<br><img src="/images/java_osgi_bndtools_proj3.png" alt="Bnd API Bundle"></p>
<p>其他保持默认，完成项目创建。</p>
<p>在第一次创建Bndtools OSGi Project时，点击完成项目创建后会弹出界面，提示创建Bndtools Configuration环境（Bndtools使用一个名为 <strong>cnf</strong> 的<br>项目保存本地Bundle仓库和共享的Bundle配置），如下图所示：</p>
<p><img src="/images/java_osgi_bndtools_proj4.png" alt="Bnd API Bundle">  </p>
<p>选择创建配置项目，按下一步，设定配置项目的模板（Bndtools支持Bundle-Hub， JPM4J和OSGi enRoute三种配置，enRoute仍在验证阶段，不太稳定，默认选择Bundle-Hub即可。）：</p>
<p><img src="/images/java_osgi_bndtools_proj5.png" alt="Bnd API Bundle">  </p>
<p><strong>注意：第一次创建cnf配置项目时，可能会因为网络问题持续很长时间，耐心等待即可</strong></p>
<p>上述步骤成功后，显示如下工程界面：<br><img src="/images/java_osgi_bndtools_proj6.png" alt="Bnd API Bundle">  </p>
<p>Bndtools OSGi项目中，最重要的文件即为.bnd文件，默认为bnd.bnd, <strong>Content</strong> 页签显示和编辑Bundle的描述信息， <strong>Build</strong> 页签控制Bundle编译依赖，<br><strong>Run</strong> 页签可以运行和调试Bundle。</p>
<p>工程界面的左下方为Bundle仓库列表，包括：  </p>
<ul>
<li>Workspace项目Bundle仓库</li>
<li>Build Bundle仓库</li>
<li>Release Bundle仓库</li>
<li>Local Bundle仓库</li>
<li>Bundle-Hub Bundle仓库</li>
</ul>
<p>如果想添加第三方Bundle仓库，如<a href="http://repository.amdatu.org/" target="_blank" rel="external">Amdatu</a>等，可以编辑 <strong>cnf&gt; ext&gt; repositories.bnd</strong> 文件，添加新的仓库。</p>
<p><img src="/images/java_osgi_bndtools_repo.png" alt="Bndtools Repo">  </p>
<p><br><br><strong>添加Greeter服务接口</strong></p>
<p>添加包：<code>org.example.greeter.api</code>，并按下面的代码定义接口：<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> org.example.greeter.api;</div><div class="line"></div><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">Greeter</span> </span>&#123;</div><div class="line">	<span class="function">String <span class="title">sayHello</span><span class="params">(String name)</span></span>;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>在前面提到的bnd.bnd的Content页签，将包<code>org.example.greeter.api</code>添加到 <strong>Export Packages</strong> 列表。</p>
<p>API Bundle构建完成。</p>
<h3 id="创建服务提供者Bundle工程"><a href="#创建服务提供者Bundle工程" class="headerlink" title="创建服务提供者Bundle工程"></a>创建服务提供者Bundle工程</h3><ul>
<li><p>工程名定义为<code>greeter-service</code>, 在Project Template向导页面，选择 ‘Component Development’ ，其他默认。<br><img src="/images/java_osgi_bndtools_proj7.png" alt="Bnd API Bundle"></p>
</li>
<li><p>在bnd的Build页签添加“greeter-api” bundle依赖</p>
</li>
<li><p>添加包：<code>org.example.greeter.service</code>，并添加GreeterService.java:</p>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">import org.example.greeter.api.Greeter;</div><div class="line">import aQute.bnd.annotation.component.Component;</div><div class="line"></div><div class="line">@Component(properties=&#123;&quot;service.exported.interfaces=*&quot;&#125;)</div><div class="line">public class GreeterService implements Greeter &#123;</div><div class="line"></div><div class="line">	@Override</div><div class="line">	public String sayHello(String name) &#123;</div><div class="line">		return &quot;Hello &quot; + name + &quot;!, This is a demo!!&quot;;</div><div class="line">	&#125;</div><div class="line"></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<ul>
<li>在bnd的Content页签，将<code>org.example.greeter.service</code>加入到Private Packages列表</li>
</ul>
<p>到此， 服务实现bundle构建完成。</p>
<p><strong>服务实现Bundle的运行与调试</strong></p>
<ul>
<li>右键选择greeter-service工程，<strong>New&gt; Run Descriptor</strong> 添加launch.bnd运行配置，如下图所示：</li>
</ul>
<p><img src="/images/java_osgi_bndtools_run.png" alt="Bndtools Run"></p>
<ul>
<li>左侧，选择运行的OSGi框架，如果框架列表里没有选项，可先到Bundle-Hub仓库中下载<code>org.apapche.felix.framework</code> 或者 <code>org.eclipse.equinox</code>  </li>
<li>在右侧,选择 <strong>Run Requirements</strong> 列表中添加要运行的bundle，点击下方的“Resolve”，成功解析后，要运行的bundle及运行时依赖会自动添加到下方<br>的“Run Bundle” 列表。</li>
<li>点击上方的“Run OSGi” 或 “Debug OSGi”按钮，运行或调试bundle，调试时直接在bundle代码里添加断点即可。</li>
<li>运行结果如下图所示：</li>
</ul>
<p><img src="/images/java_osgi_bndtools_run_result.png" alt="Bndtools Run Result"></p>
<h3 id="调用服务实现的Client-Bundle"><a href="#调用服务实现的Client-Bundle" class="headerlink" title="调用服务实现的Client Bundle"></a>调用服务实现的Client Bundle</h3><p>限于篇幅，调用服务提供者的Client Bundle不再详述，具体可参考工程代码<a href="https://github.com/christtrc/greeter-osgi-example" target="_blank" rel="external">greeter-osgi-example</a>。</p>
<h2 id="结论"><a href="#结论" class="headerlink" title="结论"></a>结论</h2><ul>
<li>Bndtools及SCR等工具和框架为快速开发OSGi应用提供了良好的支持，使得基于OSGi的开发不再因为复杂而饱受诟病。</li>
<li>在下一篇文章中，我们将在现有代码的基础上更进一步，采用 <strong>Maven</strong> 管理OSGi工程，以实现后续的Karaf部署及 <strong>IT自动化</strong>。</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/osgi/" rel="tag"># osgi</a>
          
            <a href="/tags/karaf/" rel="tag"># karaf</a>
          
            <a href="/tags/bndtools/" rel="tag"># bndtools</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/07/27/java-osgi-build-dynamic-app-with-karaf/" rel="next" title="Apache Karaf构建动态模块化应用(1)--OSGi回顾">
                <i class="fa fa-chevron-left"></i> Apache Karaf构建动态模块化应用(1)--OSGi回顾
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/07/31/java-osgi-dynamic-app-with-karaf-maven/" rel="prev" title="Apache Karaf构建动态模块化应用(3)--使用Maven自动打包部署Bundle">
                Apache Karaf构建动态模块化应用(3)--使用Maven自动打包部署Bundle <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/"
     data-title="Apache Karaf构建动态模块化应用(2)--使用Bndtools开发Bundle"
     data-content=""
     data-url="http://chrisrc.me/2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/"
           data-title="Apache Karaf构建动态模块化应用(2)--使用Bndtools开发Bundle" data-url="http://chrisrc.me/2015/07/29/java-osgi-dynamic-app-with-karaf-bndtools/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="chrisrc" />
          <p class="site-author-name" itemprop="name">chrisrc</p>
          <p class="site-description motion-element" itemprop="description"></p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">69</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">162</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/christtrc" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/chrisrc" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Bndtools"><span class="nav-number">1.</span> <span class="nav-text">Bndtools</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Bndtools的特性"><span class="nav-number">2.</span> <span class="nav-text">Bndtools的特性</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Bndtools的安装"><span class="nav-number">3.</span> <span class="nav-text">Bndtools的安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Bndtools开发示例"><span class="nav-number">4.</span> <span class="nav-text">Bndtools开发示例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#创建API-接口Bundle工程"><span class="nav-number">4.1.</span> <span class="nav-text">创建API 接口Bundle工程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建服务提供者Bundle工程"><span class="nav-number">4.2.</span> <span class="nav-text">创建服务提供者Bundle工程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#调用服务实现的Client-Bundle"><span class="nav-number">4.3.</span> <span class="nav-text">调用服务实现的Client Bundle</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#结论"><span class="nav-number">5.</span> <span class="nav-text">结论</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">
     
      <a href="mailto:chrisrc@qq.com">chrisrc</a> 
    
  </span>
  <span class="author"> &nbsp; QQ: 58122705 </span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"chrisrc"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  








  
  

  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
<script>
(function(){
   var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04":"https://jspassport.ssl.qhimg.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04";
   document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
</script>

  


</body>
</html>
